﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Furion.DatabaseAccessor;
using Microsoft.EntityFrameworkCore;

namespace LuoYi.Admin.Entities;

/// <summary>
/// 用户信息表
/// </summary>
[Table("sys_user")]
public class SysUser : IEntity
{
    /// <summary>
    /// 用户ID
    /// </summary>
    [Key]
    [Column("user_id", TypeName = "bigint(20)")]
    public long UserId { get; set; }

    /// <summary>
    /// 部门ID
    /// </summary>
    [Column("dept_id", TypeName = "bigint(20)")]
    public long? DeptId { get; set; }

    /// <summary>
    /// 用户账号
    /// </summary>
    [Column("user_name")]
    [StringLength(30)]
    public string UserName { get; set; } = null!;

    /// <summary>
    /// 用户昵称
    /// </summary>
    [Column("nick_name")]
    [StringLength(30)]
    public string NickName { get; set; } = null!;

    /// <summary>
    /// 用户类型（00系统用户）
    /// </summary>
    [Column("user_type")]
    [StringLength(2)]
    public string? UserType { get; set; }

    /// <summary>
    /// 用户邮箱
    /// </summary>
    [Column("email")]
    [StringLength(50)]
    public string? Email { get; set; }

    /// <summary>
    /// 手机号码
    /// </summary>
    [Column("phonenumber")]
    [StringLength(11)]
    public string? Phonenumber { get; set; }

    /// <summary>
    /// 用户性别（0男 1女 2未知）
    /// </summary>
    [Column("sex")]
    [StringLength(1)]
    public string? Sex { get; set; }

    /// <summary>
    /// 头像地址
    /// </summary>
    [Column("avatar")]
    [StringLength(100)]
    public string? Avatar { get; set; }

    /// <summary>
    /// 密码
    /// </summary>
    [Column("password")]
    [StringLength(100)]
    public string? Password { get; set; }

    /// <summary>
    /// 账号状态（0正常 1停用）
    /// </summary>
    [Column("status")]
    [StringLength(1)]
    public string? Status { get; set; }

    /// <summary>
    /// 删除标志（0代表存在 2代表删除）
    /// </summary>
    [Column("del_flag")]
    [StringLength(1)]
    public string? DelFlag { get; set; }

    /// <summary>
    /// 最后登录IP
    /// </summary>
    [Column("login_ip")]
    [StringLength(128)]
    public string? LoginIp { get; set; }

    /// <summary>
    /// 最后登录时间
    /// </summary>
    [Column("login_date", TypeName = "datetime")]
    public DateTime? LoginDate { get; set; }

    /// <summary>
    /// 密码最后更新时间
    /// </summary>
    [Column("pwd_update_date", TypeName = "datetime")]
    public DateTime? PwdUpdateDate { get; set; }

    /// <summary>
    /// 创建者
    /// </summary>
    [Column("create_by")]
    [StringLength(64)]
    public string? CreateBy { get; set; }

    /// <summary>
    /// 创建时间
    /// </summary>
    [Column("create_time", TypeName = "datetime")]
    public DateTime? CreateTime { get; set; }

    /// <summary>
    /// 更新者
    /// </summary>
    [Column("update_by")]
    [StringLength(64)]
    public string? UpdateBy { get; set; }

    /// <summary>
    /// 更新时间
    /// </summary>
    [Column("update_time", TypeName = "datetime")]
    public DateTime? UpdateTime { get; set; }

    /// <summary>
    /// 备注
    /// </summary>
    [Column("remark")]
    [StringLength(500)]
    public string? Remark { get; set; }
}
